<?php
	//设置编码
	header("Content-type:text/html;charset=utf-8");
	//读取主题样式
	$style = getStyleName();
	//读取导航
	$artkindlist = getAirtkindList();
	$topmenu = getTopMenuData();
	$logotext = getConfig('logotext');
	$smarty->assign('topmenu',$topmenu);
	$smarty->assign('logotext',$logotext);
	$smarty->assign('list',$artkindlist);
	$smarty->assign('templete',$style);
	//读取登录信息
	if(isset($_SESSION['userid'])){
		$user = getUserById($_SESSION['userid']);
		$smarty->assign('user',$user);
	}else{
		if(isset($_COOKIE['username'])&&isset($_COOKIE['md5password'])){
			if(loginSub($_COOKIE['username'],$_COOKIE['md5password'])==true){
				$user = getUserByName($_COOKIE['username']);
				$_SESSION['userid'] = $user['uid'];
			}
			$user = getUserById($_SESSION['userid']);
			$smarty->assign('user',$user);
		}
	}
	$smarty->display($_config['root']."templete/{$style}/head.html");
?>